package com.app.newcsc.data.source;

import com.app.newcsc.entity.Article;
import com.app.newcsc.entity.ArticleEntity;
import com.app.newcsc.entity.AssetIndexEntity;
import com.app.newcsc.entity.BillEntity;
import com.app.newcsc.entity.ConfigEntity;
import com.app.newcsc.entity.DemoEntity;
import com.app.newcsc.entity.DetailEntity;
import com.app.newcsc.entity.ExchangeCoinEntity;
import com.app.newcsc.entity.ExchangeHomeEntity;
import com.app.newcsc.entity.ExchangeLogEntity;
import com.app.newcsc.entity.ExchangeRecordEntity;
import com.app.newcsc.entity.FinanceOrderAllEntity;
import com.app.newcsc.entity.FinancingOrderEntity;
import com.app.newcsc.entity.FiveBuyFiveSellEntity;
import com.app.newcsc.entity.FundsBalanceEntity;
import com.app.newcsc.entity.GetTokenEntity;
import com.app.newcsc.entity.LevelInfoEntity;
import com.app.newcsc.entity.OrderListEntity;
import com.app.newcsc.entity.OtcConfig;
import com.app.newcsc.entity.PayAccountEntity;
import com.app.newcsc.entity.PlanIndexEntity;
import com.app.newcsc.entity.PointEntity;
import com.app.newcsc.entity.QiniuToken;
import com.app.newcsc.entity.ShopTokenEntity;
import com.app.newcsc.entity.SityServiceLogEntity;
import com.app.newcsc.entity.TaskInfoEntity;
import com.app.newcsc.entity.TimeNumZone;
import com.app.newcsc.entity.TransactionOrderEntity;
import com.app.newcsc.entity.TransactionPlanEntity;
import com.app.newcsc.entity.TransactionPlanListData;
import com.app.newcsc.entity.UpGradeEntity;
import com.app.newcsc.entity.UpdateCongigEntity;
import com.app.newcsc.entity.UploadFileEntity;
import com.app.newcsc.entity.UserEntity;
import com.app.newcsc.entity.UserInfoEntity;
import com.app.newcsc.entity.WalletEntity;
import com.app.newcsc.entity.WalletTypeEntity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import me.goldze.mvvmhabit.http.BaseResponse;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Response;
import retrofit2.http.Header;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * Created by goldze on 2019/3/26.otc/plan/lists
 */
public interface HttpDataSource {
    //模拟登录
    Observable<Object> login();

    //模拟上拉加载
    Observable<DemoEntity> loadMore();

    Observable<BaseResponse<DemoEntity>> demoGet();

    Observable<BaseResponse<DemoEntity>> demoPost(String catalog);


    //*******************基础接口****************************

    /** 资产明细
     * @param
     * @return
     */
    Observable<ArrayList<DetailEntity>> lockLog(String coin_id);


    /** 等级提升
     * @param
     * @return
     */

    Observable<UpGradeEntity> upGrade();

    /** 等级提升价格信息
     * @param
     * @return
     */

    Observable<LevelInfoEntity> levelInfo();

    /** 给AIPass做第三方登录获取token
     * @param
     * @param mobile
     * @return
     */
    Observable<BaseResponse<GetTokenEntity>> getToken(String mobile);

    /** 上传文件
     * type  string
     * file  ($binary)
     * @param
     * @param file
     * @return
     */
    Observable<BaseResponse<UploadFileEntity>> uploadFile(String type, MultipartBody.Part file);

    /** 发送短信验证码
     * type:手机验证码类型：1:注册，2:找回密码，3:更换手机号, 4:添加银行卡, 5:设置支付密码,6: 登陆, 11: otc支付, 12: 挂单 用户, 13:挂单 订单
     * Request body        phone   type
     * @return
     */
    Observable<ResponseBody> smsCode(HashMap<String, Object> map);

    /** 获取验证码
     * @return
     */
    Observable<BaseResponse> captcha();

    /** 缩略图
     * template 图片处理模板，默认有 small,medium,large三种
     * image_path 储存的文件名，程序保存时的路径
     * @return
     */
    Observable<BaseResponse> captcha(String template, String image_path);

    /** 配置信息
     * template 图片处理模板，默认有 small,medium,large三种
     * image_path 储存的文件名，程序保存时的路径
     * @return
     */
    Observable<BaseResponse<ConfigEntity>> apiConfigs();

    /** 获取知天下商城token
     * @return
     */
    Observable<BaseResponse<ShopTokenEntity>> getZTXShopToken(String mobile);

    /** 积分兑换AD或CSC
     * @return
     */
    Observable<ResponseBody> pointExchangeCsc(HashMap<String, Object> map);

    /** 获取积分
     * @return
     */
    Observable<PointEntity> pointWallet();

    Observable<BaseResponse<List<BillEntity>>> walletLog(String page);
//*******************基础接口****************************


    //---------------------------用户-----------------------------
    Observable<BaseResponse<ShopTokenEntity>> login(@QueryMap HashMap<String, Object> map);
    /**http://newcsc.chaishows.com/api/base/user
     * 当期登录用户信息
     * @return
     */
    Observable<BaseResponse<UserEntity>> baseUser();

    /**http://newcsc.chaishows.com/api/base/user/password
     * 重置密码
     * @return
     */
    Observable<Response<Void>> reSetUserPassword(HashMap<String, Object> map);


    /**
     * 用户登出
     * @return
     */
    Observable<ResponseBody> logoutCurrent();
    //---------------------------用户-----------------------------


    Observable<BaseResponse> getCSCToken(@Query("token") String token);

    Observable<BaseResponse<List<FinanceOrderAllEntity>>> financeProduct(HashMap<String, Object> map);
    Observable<BaseResponse> financeProductDetail(String id);


    Observable<BaseResponse<List<FinanceOrderAllEntity>>> financeProductOrders(String status, String include,HashMap<String, Object> map);

    /**
     * 任务包 创建订单
     * id  产品id；  quantity 数量；payment_password 支付密码
     * @return
     */
    Observable<ResponseBody> createFinanceProductOrder(HashMap<String, Object> map);

    /**
     * 任务包 订单详情
     * @return
     */
    Observable<BaseResponse> financeProductOrderDetails(String id,String include);

    /**
     * 文章接口
     * @return
     */
    Observable<BaseResponse<Article>> zdeskArtivle(String id);



//--------------------钱包日志记录-----------------

    /**http://newcsc.chaishows.com/api/otc/bill?type=100
     * 钱包日志记录
     * @param
     * @param type 类型, 多个英文逗号隔开
     * @return
     */
    Observable<BaseResponse<List<BillEntity>>> otcBill(String type, String include,String page);

    /**http://newcsc.chaishows.com/api/otc/bill/1
     * 钱包日志详情
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse> otcBillDetail(@Path("id") String id);

    /**http://newcsc.chaishows.com/api/otc/bill/types
     * 钱包类型列表
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<List<WalletTypeEntity>>> otcBillTypes();




    //--------------------otc buy-----------------
    /**http://newcsc.chaishows.com/api/otc/buy/lists?filter[status]=0
     * 我的订单记录
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<List<TransactionPlanEntity>>> otcBuyLists(String status,String page);

    /**http://newcsc.chaishows.com/api/ohttp://newcsc.chaishows.com/api/otc/buy/show/229555
     * 我的订单详情
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<TransactionOrderEntity>> otcBuyShowOrder(String id);

    /**http://newcsc.chaishows.com/api/otc/buy?id=001&type=1&num=1&payment_password="123456"
     * 挂单订单 创建
     * id  planUser id , 状态为 0
     * type 类型:1=购买,2=出售
     * num 挂单数量
     * payment_password 支付密码
     * idcard  卡后6位,如果type=2必填
     * code 短信码,如果type=2必填
     * @param
     * @return
     */
    Observable<ResponseBody> otcBuy(String id,String type,String num,String payment_password,String idcard,String code);

    /**http://newcsc.chaishows.com/api/otc/buy/confirm?id=001&payment_password="123456"
     * 卖家 确认订单
     * @param
     * @return
     */
    Observable<ResponseBody> otcBuyConfirm(String id,String payment_password);
    /**http://newcsc.chaishows.com/api/otc/buy/submit?id=001&payment_password="123456"&pay_id=1&image
     * 买家 确认上传
     * @param
     * @return
     */
    Observable<ResponseBody> otcBuySubmit(String id,String pay_id,String image,String payment_password);
    /**http://newcsc.chaishows.com/api/otc/buy/appeal?id=001&content ="1111"&image
     * 仲裁
     * @param
     * @param
     * @return
     */
    Observable<ResponseBody> otcBuyAppeal(String id,String image,String content);

//--------------------otc buy----------------

//--------------------otc 接口----------------
    /**http://newcsc.chaishows.com/api/otc/config
     * otc 配置信息
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<OtcConfig>> otcConfig();
    /**http://newcsc.chaishows.com/api/sityservice/log
     * 服务商活跃指数记录
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<SityServiceLogEntity>> sityServiceLog();

//--------------------otc 接口----------------

//--------------------otc 支付记录接口接口----------------
    /**http://newcsc.chaishows.com/api/otc/payaccount
     * 支付记录
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<List<PayAccountEntity>>> otcPayCccount();
    /**http://newcsc.chaishows.com/api/otc/payaccount
     * 添加支付记录
     * @param
     * @param {"type": 1,"account": "Entity","name": "Unpro","address": "dsfdsfds","branch": "branch","code": 1234}
     * @return
     */
    Observable<ResponseBody> addOtcPayCccount(HashMap<String, Object> map);
    /**http://newcsc.chaishows.com/api/otc/payaccount?id=1
     * 删除支付记录
     * @param
     * @param
     * @return
     */
    Observable<ResponseBody> deleteOtcPayCccount(String id);
    /**http://newcsc.chaishows.com/api/otc/payaccount/1
     * 支付记录详情
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse> otcPayCccountDetail(String id);
//--------------------otc 支付记录接口接口----------------


//--------------------otc 挂单接口----------------
    /**http://newcsc.chaishows.com/api/otc/plan?filter[status]=0
     * 我的挂单-用户列表  filter筛选: status 订单状态:0=进行中,1=完成 2取消 3 待审核
     *  include   orders
     * @param
     * @return
     */
    Observable<BaseResponse<List<TransactionPlanEntity>>> otcPlanLists(String status, String orders, String page);

    /**http://newcsc.chaishows.com/api/otc/plan/orders?is_confirm=1
     * 挂单列表  五买 五卖
     * @param
     *       is_confirm=1 五买  is_confirm=0 五卖
     * @return
     */
    Observable<BaseResponse<List<FiveBuyFiveSellEntity>>> otcPlanOrders(String is_confirm);

    /**http://newcsc.chaishows.com/api/otc/plan/lists?num_zone=100-500&filter[type]=1&filter[status]=0
     * 挂单 大厅  filter 筛选: status 订单状态:0=进行中,1=完成 2取消 3 待审核, type: 1=购买,2=出售
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<List<TransactionPlanEntity>>> planLists(String type, String status, String num_zone, String page);


    //*******************************************
    /**
     * 挂单-创建planuser
     *  type  类型:1=购买,2=出售
     *  num   挂单数量
     *  pay_types   1 2 3
     *  payment_password  支付密码
     *  price    价格
     *  idcard   身份证尾号6位,如果type=2必填
     *  code    短信码, 如果type=2必填
     * @return
     */
    Observable<ResponseBody> otcPlanCreate(HashMap<String, Object> map);

    /**
     * 取消挂单
     * @return
     */
    Observable<ResponseBody> otcPlanCancel(String id);

    /**
     * 挂单详情
     * @return
     */
    Observable<BaseResponse<TransactionOrderEntity>> otcPlanOrderDetail(String id);

    /**
     * 挂单用户详情
     * @return
     */
    Observable<BaseResponse<TransactionPlanEntity>> otcPlanOrderUserDetail(String id,String include);
    /**
     * 挂单数据
     * @return
     */
    Observable<PlanIndexEntity> otcPlanData();
    //*******************************************
//--------------------otc 挂单接口----------------




    /**http://newcsc.chaishows.com/api/finance/fund/coin
     * 兑换币种
     * @return
     */
    Observable<BaseResponse<ExchangeCoinEntity>> exchangeCoin();

    /**http://newcsc.chaishows.com/api/otc/exchange_log?include=filter[1]
     * 兑换记录
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<List<ExchangeLogEntity>>> exChangeLog(String include,String page);

//--------------------钱包日志记录-----------------

//--------------------钱包-----------------
    /**http://newcsc.chaishows.com/api/otc/wallet/coins
     * 钱包类型 列表
     * @param
     * @param
     * @return
     */
    Observable<Map<String,String>> walletCoins();

    /**http://newcsc.chaishows.com/api/otc/wallet ?include=filter[1]
     * 钱包余额
     * @param
     * @param
     * @return
     */
    Observable<BaseResponse<List<WalletEntity>>> otcWallet(@Query("include") String include);
//--------------------钱包-----------------







    /**
     * 分区
     * @param map
     * @return
     */
    Observable<BaseResponse<TimeNumZone>> otcConfig(HashMap<String, Object> map);

    /**
     * 我要买
     * @param map
     * @return
     */
    Observable<BaseResponse<TransactionPlanListData>> planList(HashMap<String, Object> map);

    Observable<BaseResponse<WalletEntity>> planWallet(HashMap<String, Object> map);

    /**
     * 订单
     * @param map
     * @return
     */
    Observable<BaseResponse<OrderListEntity>> orderList(@QueryMap HashMap<String, Object> map);

    /**
     * 挂单
     * @param map
     * @return
     */
    Observable<BaseResponse<OrderListEntity>> orderGuaDanList(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<FundsBalanceEntity>> fundsBalance(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<AssetIndexEntity>> assetIndex(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<UserInfoEntity>> userInfo(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<TaskInfoEntity>> otherAssets(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<FinancingOrderEntity>> financingorderList(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<FinancingOrderEntity>> financingList(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<UpdateCongigEntity>> apiConfig();
    Observable<BaseResponse<UpdateCongigEntity>> apiConfig2();

    Observable<BaseResponse<List<ArticleEntity>>> getArticle(@Path("id") String type);

    Observable<BaseResponse> smsSetpassword(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse> setPassword(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<SityServiceLogEntity>> sityServiceLog(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse> payAccountList(@QueryMap HashMap<String, Object> map);
    Observable<BaseResponse> smsGeneral(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse> payAccountCreate(@QueryMap HashMap<String, Object> map);
    Observable<BaseResponse<QiniuToken>> qiniuToken(@QueryMap HashMap<String, Object> map);
    Observable<BaseResponse<UploadFileEntity>> uploadFiles(@Header("token") String token, @Part() MultipartBody.Part file);

    Observable<BaseResponse<PlanIndexEntity>> planIndex(@QueryMap HashMap<String, Object> map);

    Observable<BaseResponse<ExchangeHomeEntity>> exchangeHome();
    /**http://newcsc.chaishows.com/api/finance/ztx_shop/wallet/exchange?amount=10&coin_id=3&to_coin_id=5&payment_password=123456
     * AD兑换积分
     * @return
     */
    Observable<Response<Void>> exchange(HashMap<String, Object> map);

    Observable<BaseResponse<ShopTokenEntity>> getShopToken();

    Observable<BaseResponse<ExchangeRecordEntity>> exchangeRecord(@QueryMap HashMap<String, Object> map);
}
